#ifndef QIK_H
#define QIK_H

#include "Image.h"
#include "DoubleMatrix.h"
#include "ByteStream.h"

#include <fstream>

class Qik: public Image
{
public:
	Qik();
	Qik(unsigned int newWidth, unsigned int newHeight);
	~Qik();

	virtual void ReadFromFile(const char* filename);
	virtual void WriteToFile(const char* filename);

	void StartLogging(const char *filename);
	void StopLogging();
	bool Logging() const;

	void SetCompressionFactor(double factor);

protected:

private:
	std::ofstream *logfile;
	double compressionFactor;

	static const unsigned int BLOCKW = 4, BLOCKH = 4;
	static const char *VERSIONHEADER;
	static const double defaultCompressionFactor;
	static DoubleMatrix defaultQuantizationTable;


	std::ofstream& Log();
	void ReadFromStream(ByteStream& stream);
	void WriteToStream(ByteStream& stream);

};

#endif //QIK_H
